<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="x-ua-compatible" content="IE=edge, chrome=1">
    <title>j5shop商城</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link href="/street/css/public.css" type="text/css" rel="stylesheet"/>
    <link href="/street/css/order.css" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" src="/street/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/street/js/slide.js"></script>
    <script src="/js/plugins/layer/layer.min.js"></script>
</head>
<script>
    $(function(){
        $('.nav ul li').hover(function(){
            $(this).children(".details").show();
        },function(){
            $(this).children(".details").hide();
        });
        $('#my').hover(function(){
            $(this).find("div").show();
        },function(){
            $(this).find("div").hide();
        });
    });
</script>
<body>
<div th:replace="street/layout/mallHeader"></div>
<!---------------------导航完--------------------->
<div class="wt1080">
    <!--------------标题----------->
    <div class="my_order">
        <h1>提交订单</h1>
        <div class="place">
            <ul>
                <li class="current"><span>1</span><p>我的购物车</p></li>
                <li class="current"><span>2</span><p>提交订单</p></li>
                <li><span>3</span><p>选择支付方式</p></li>
            </ul>
            <span class="heng"></span>
            <span class="a_heng"></span>
        </div>
    </div>
    <!-------------收货地址-------------->
    <div class="address">
        <div class="roo">收货地址<span></span></div>
        <div class="b_address">
            <ul>
                <li class="current" th:each="address:${addressList}">
                    <h1><span  th:text="${address.name}">张新</span>
                        <span th:text="${address.mobile}">159****3994</span></h1>
                    <p th:text="${address.detail}">四川省 成都市 </p>
                    <p th:text="${address.detail}">身份证号码：510524********1905</p>
                    <div class="operate">
                        <a href="#" th:onclick="'editAddress('+${address.id}+')'" class="edit">编辑</a>
                        <a href="#" th:onclick="'delAddress('+${address.id}+')'"  class="del">删除</a>
                    </div>
                    <div th:label="${address.id}" th:class="${address.isdefault eq 0 ? 'user-addresslist check':'user-addresslist'}"></div>
                </li>

            </ul>
            <div class="add_address"><a href="#">添加地址</a></div>
            <div class="clear"></div>
        </div>
    </div>
    <!---------------订单信息-------------->
    <div class="order_details">
        <div class="roo">订单信息<span></span></div>
        <input th:hidden="true" th:value="${cart_id_list}" id="cart_id_list"/>
        <div class="tt">
            <table>
                <tr>
                    <th width="50%">商品</th>
                    <th width="16%">单价</th>
                    <th width="16%">数量</th>
                    <th width="18%">小计</th>
                </tr>
                <tr th:each="goods:${cartList}">
                    <td>
                        <div class="pic">
                            <img th:src="@{${goods.img}}" src="/street/image/p2.jpg"></div>
                        <p class="one"><a th:href="@{'/street/goodsDetail/'+${goods.goodsid}}" th:text="${goods.goodsname}">几的萨克的哈萨</a></p>
                        <p class="two" >韩国一号仓发货</p>
                    </td>
                    <td><span class="e" th:text="'￥'+${goods.price}">￥318.00</span></td>
                    <td th:text="${goods.count}">1</td>
                    <td><span class="u" th:text="'￥'+${goods.totalprice}">￥318.00</span></td>
                </tr>


            </table>
        </div>
    </div>
    <!------------------优惠卷--------------->
    <div class="coupon">
        <div class="roo">优惠卷<span></span></div>
        <div class="rr">
            <p>此订单暂无可用的优惠卷。您可以<a href="#">查看所有的优惠卷</a>了解使用限制。<a href="#">[了解京东优惠卷规则]</a></p>
            <div class="ff">
                <ul>
                    <li>
                        <select data-placeholder="选择优惠劵" name="couponid" id="couponid"
                                class="form-control chosen-select" tabindex="2"
                                style="width: 100%">
                            <option value="">选择优惠劵</option>
                            <option th:value="${coupon.id}" th:each="coupon:${couponList}"
                                    th:text="${coupon.couponName}">选择品牌
                            </option>
                        </select>
                    </li>
                </ul>
            </div>
            <p style="border-bottom: none;">共使用了<font>0</font>张优惠卷 <span>可以优惠<font>0.00</font>元</span></p>
        </div>
        <div class="kk">
            <table>
                <tr>
                    <td>商品总金额：</td>
                    <td th:text="${totalprice}">￥436.00</td>
                </tr>
                <tr>
                    <td>+运费：</td>
                    <td>￥0.00</td>
                </tr>
                <tr>
                    <td>+关税：</td>
                    <td>￥0.00</td>
                </tr>
                <tr>
                    <td>-商品优惠：</td>
                    <td>￥0.00</td>
                </tr>
            </table>
            <p class="money">应付余额：<span th:text="${totalprice}">￥<font>436.00</font></span></p>
        </div>
        <div class='clear'></div>
        <!---------------委托下的版本---------------->
        <div class="ll">
            <div class="bb">
                <h1>个人委托申报协议</h1>
                <p>本人承诺所购买商品系个人合理自用，现委托商家代理申报，代缴税款等通关事宜，本人保证遵守《海关法》和国家相关法律法规，保证所提供的身份信息和收货信息真是完整，无侵犯他人权益的行为，以上委托关系如实填写，本人愿意接受海关，检查检疫机构及其他监管部门的监管，并承担相应法律责任。</p>
            </div>
            <div class="ss">
                <p class="bg">寄送至：大石路130号</p>
                <p>收货人：张新 159****3994</p>
            </div>
            <div class="gg">
                <p>应付余额：<span>￥<font id="totalBlance" th:text="${totalprice}">436.00</font></span></p>
            </div>
            <a href="#"><input type="button" onclick="submitOrder()" value="确认提交订单" ></a>
            <div class="clear"></div>
        </div>
    </div>

</div>
<script type="text/javascript">
    var addressid = 1;
    $(function() {
        $(".user-addresslist").click(function () {
            $(this).addClass("check").siblings().removeClass("check");
            addressid =jQuery(this).attr("label");
        });
    });

    var couponid = $("#couponid").val();
    function submitOrder(){
        var data = {};
        data.totalBlance=$("#totalBlance").html();
        data.addressid=addressid;
        data.couponid=couponid;

        $.ajax({
            type: "post",
            url: '/person/street/submitOrder',
            data: data,
            dataType: "json",
            success:function(res) {
                console.log(res);
                if(res.code==0){
                    var id = res.data.id;
                    window.location.href = "/person/street/pay/"+id;
                }else {
                    layer.msg("订单已提交!",2, 8);
                    window.location.href = "/street/index"
                }
            }
        });
    }
    function addRePly(){
        var content=$("#say_some").val();
        var goodsid=$("#goodsid").val();
        $.ajax({
            type: "post",
            url: '/person/street/addRePly',
            data: {content:content,goodsid:goodsid},
            dataType: "json",
            success:function(data) {
                if(data.success){
                    layer.msg("评论成功!",{icon:2});

                }else{
                    layer.msg("评论失败!",{icon:2});
                }
            }
        });
    }
</script>
<div th:replace="street/layout/mallFooter"></div>
</body>
</html>
